#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef double db;

#define in read()
#define pii pair<int,int>
#define fi first
#define se second
#define FILE(x) freopen(x".in","r",stdin);\
	freopen(x".out","w",stdout);
#define pb push_back

int read(){
	int x = 0,sgn = 1;char ch = getchar();
	for(;!isdigit(ch);ch = getchar()) if(ch == '-') sgn = -1;
	for(;isdigit(ch);ch = getchar()) x = (x<<1)+(x<<3)+(ch^48);
	return x*sgn;
}

const int N = 5e5+10;

struct edge{int v;db w;int nxt;}e[N<<1];
db f[N],g[N],q[N];
int h[N],n,cnt;
void link(int x,int y,db w){e[++cnt] = (edge){y,w,h[x]};h[x] = cnt;}

void dfs(int x,int p){
	db P = 1.0;
	for(int i = h[x],y;i;i = e[i].nxt){
		if((y = e[i].v) == p) continue;
		dfs(y,x);
		P = P * (1 - e[i].w + e[i].w * f[y]);
	}
	f[x] = P * (1 - q[x]);
}

void dfs1(int x,int p){
	db P; if(x == 1) g[x] = f[x];
	for(int i = h[x],y;i;i = e[i].nxt){
		if((y = e[i].v) == p) continue;
		P = g[x] / (1 - e[i].w + e[i].w * f[y]);
		g[y] = f[y] * (1 - e[i].w + e[i].w * P);
		dfs1(y,x);
	}
}

int main (){
#ifndef ONLINE_JUDGE
	freopen("1.in","r",stdin);
#endif
	n = in;
	for(int i = 1;i < n;i++){
		int u = in,v = in;db w = in * 1.0 / 100;
		link(u,v,w); link(v,u,w);
	}
	for(int i = 1;i <= n;i++) q[i] = in / 100.0;
	dfs(1,0); dfs1(1,0);
	db ans = 0;
	for(int i = 1;i <= n;i++) ans += 1 - g[i];
	printf("%.6lf\n",ans);
	return 0;
}

